package me.xiaoyan.ehr.controller;

import me.xiaoyan.ehr.mapper.ChartMapper;
import me.xiaoyan.ehr.vo.ApiResponseData;
import me.xiaoyan.ehr.vo.NameValueEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/charts")
public class ChartController {
    @Resource
    private ChartMapper chartMapper;
    // 职位统计
    @GetMapping("/job-count")
    public ApiResponseData<List<NameValueEntity>> countJob(){
        ApiResponseData<List<NameValueEntity>> data = new ApiResponseData<>();
        data.setData(
                chartMapper.countJob()
        );
        return data;
    }

    // 统计 最高学历
    @GetMapping("/count-degree")
    public ApiResponseData<List<NameValueEntity>> countDegree(){
        ApiResponseData<List<NameValueEntity>> data = new ApiResponseData<>();
        data.setData(
                chartMapper.countDegree()
        );
        return data;
    }
}
